<?php

/**
 * @author senthil
 * @copyright 2011
 */

function makeUrl($url = '')
{
    global $config;
    return $config['site']['url'].urlSeperator.$url;
}

function sideLink($title,$url,$bold=false)
{
    global $config;
    $url = ($url=='#')?'#':makeUrl($url);
    //debug($_SERVER);
    $className = ($url==selfURL() || $bold==true)?'blackcolor':'';    
    ?>
    <li class="<?=$className.' '.$bold?> "><a  href="<?=$url?>" class='basic'><?=$title?></a></li>
    <?php
}
function selfURL() 
{ 
    $s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : ""; 
    $protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/").$s; 
    $port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]); 
    return $protocol."://".$_SERVER['SERVER_NAME'].$port.$_SERVER['REQUEST_URI']; 
} 
function strleft($s1, $s2) 
{ 
    return substr($s1, 0, strpos($s1, $s2)); 
}
function breadCrumb()
{
global $config;
$top_header_loader['index'] = array('index.html' => 'homepage');
$top_header_loader['innerone'] = array('index.html' => 'homepage');
$top_header_loader['about'] = array('index.html' => 'homepage','#' => 'SlotDrain');
$top_header_loader['access_covers'] = array('index.html' => 'homepage','#' => 'Access Covers');
$top_header_loader['slotcover_testimonial'] = array('index.html' => 'homepage','access_covers.html' => 'Access Covers','#Testimonial' => 'Testimonial','#' => 'Access Covers');
$top_header_loader['slotdrain_testimonial'] = array('index.html' => 'homepage','about.html' => 'SlotDrain','#Testimonial' => 'Testimonial');
$top_header_loader['product_selector'] = array('index.html' => 'homepage','about.html' => 'SlotDrain','slotdrain_testimonial.html' => 'Slotdrain Testimonial','#' => 'Product Selector');


$top_header_loader['ultraslot_features_benefits'] = array('index.html' => 'homepage','about.html' => 'SlotDrain','slotdrain_testimonial.html' => 'Slotdrain Testimonial','product_selector.html' => 'Product Selector', '##' => 'UltraSlot - Features & Benefits');

$top_header_loader['ultraslot_features'] = array('index.html' => 'homepage','about.html' => 'SlotDrain','slotdrain_testimonial.html' => 'Slotdrain Testimonial','product_selector.html' => 'Product Selector', '##' => 'UltraSlot - Features & Benefits');

$top_header_loader['ultr_slot_range'] = array('index.html' => 'homepage','about.html' => 'SlotDrain','slotdrain_testimonial.html' => 'Slotdrain Testimonial','###' => 'Case Studies', 'product_selector.html' => 'Product Selector', '#ultrslot' => 'Ultraslot', '#ultrslotrange' => 'Ultraslot Range');

$top_header_loader['ultr_slot_typical_app'] = array('index.html' => 'homepage','about.html' => 'SlotDrain', 'product_selector.html' => 'Product Selector', '#ultrslot' => 'UltraSlot - Features & Benefits', '#ultrslotrange' => 'UltraSlot - Applications');

$top_header_loader['company'] = array('index.html' => 'homepage','#' => 'Company');
$top_header_loader['ultr_slot_casestudy'] = array('index.html' => 'homepage','about.html' => 'SlotDrain',  '#ultrslot' => 'UltraSlot - Features & Benefits', '#ultrslotrange' => 'UltraSlot - Applications');


$top_header_loader['slotdrain_view_by_app'] = array('index.html' => 'homepage','about.html' => 'SlotDrain', 'product_selector.html' => 'Product Selector', '#ultrslotrange' => 'Slotdrain Applications');

$top_header_loader['slotdrain_view_by_product'] = array('index.html' => 'homepage','about.html' => 'SlotDrain', 'product_selector.html' => 'Product Selector', '#ultrslotrange' => 'Slotdrain Applications');

$top_header_loader['ultraslotdrain_testimonal'] = array('index.html' => 'homepage','about.html' => 'SlotDrain', '#ultrslot' => 'UltraSlot - Features & Benefits', '#ultrslotrange' => 'UltraSlot - Applications', '#Testimonials' => 'UltraSlot - Testimonials');

$top_header_loader['slot_features_benifits'] = array('index.html' => 'homepage','about.html' => 'SlotDrain', '#ultrslot' => 'UltraSlot - Features & Benefits');


$top_header_loader['slot_tech_support'] = array('index.html' => 'homepage','about.html' => 'SlotDrain', '#ultrslot' => 'Slotdrain Technical Support');

$top_header_loader['testimonal_slotdrain'] = array('index.html' => 'homepage','#' => 'SlotDrain');

$top_header_loader['access_covers_testimonal'] = array('index.html' => 'homepage','#' => 'Access Covers');

$top_header_loader['access_covers_benifits'] = array('index.html' => 'homepage','access_covers.html' => 'Access Covers', '#ultrslot' => 'Case Studies','product_selector.html' => 'Product Selector', '#' => 'Features and Benifits');

$top_header_loader['access_covers_view_by_app'] = array('index.html' => 'homepage','access_covers.html' => 'Access Covers','product_selector.html' => 'Product Selector', '#' => 'Gatic Covers Applications');

$top_header_loader['access_covers_view_by_product'] = array('index.html' => 'homepage','access_covers.html' => 'Access Covers', '#' => 'Gatic Covers Applications');

$top_header_loader['access_covers_features_benifits'] = array('index.html' => 'homepage','access_covers.html' => 'Access Covers', '#' => 'Gatic Covers Features & Benefits');

$top_header_loader['access_covers_tech_support'] = array('index.html' => 'homepage','access_covers.html' => 'Access Covers', '#Gatic' => 'Gatic Covers Features & Benefits', '#' => 'Gatic Cover Technical Support');

$top_header_loader['access_covers_load_cat'] = array('index.html' => 'homepage','access_covers.html' => 'Access Covers', 'product_selector.html' => 'Product Selector', '#Recessed covers' => 'Recessed covers', '#Features & Benefits' => 'Features & Benefits', '#Applications & Loadings' => 'Applications & Loadings');

$top_header_loader['access_covers_load_grp'] = array('index.html' => 'homepage','access_covers.html' => 'Access Covers', '#Casestudy' => 'Case Studies', 'product_selector.html' => 'Product Selector');

$top_header_loader['access_duct_covers_benifits'] = array('index.html' => 'homepage','access_covers.html' => 'Access Covers', '#Features and Benefits' => 'Features and Benefits', '#Applications & Loadings' => 'Applications & Loadings', '#Technical Specifications' => 'Technical Specifications');

$top_header_loader['accesscover_downloads'] = array('index.html' => 'homepage','#' => 'Downloads and Tutorials');

$top_header_loader['slotdrain_downloads'] = array('index.html' => 'homepage','#' => 'Downloads and Tutorials');

$file_name = $config['site']['pageinfo']['filename'];	
	if(isset($top_header_loader[$file_name]))
	{
		$loaded_bcrumb = $top_header_loader[$file_name];		
	}
	else
	{
		$loaded_bcrumb = $top_header_loader['index'];
		
	}	
	?>
	<ul class="breadcrumb">
	<?php
	$count = 1;
	$array_count = count($loaded_bcrumb);
	$class = '';
	foreach($loaded_bcrumb as $link => $text)
	{
	?>    
        <?php 
		if($count == $array_count) {  $class = ' class ="last"'; }
		echo '<li '.$class.'><a href="'.$link.'">'.$text.'</a></li>';  $count++;
		
		?>        
    
    <?php 
	}	
	?>
	</ul>
	<?php	
	
}

function get_radio_button($radio_name)
{
	global $config;	
	
	switch( $radio_name )
	{	
		case 'ultraslot_tech':
			$ultraslot_tech = ''; 				
			if($config['site']['currentPage'] == 'ultr_slot_range') 
			{
				$ultraslot_tech = 'checked'; 				
			}
			return '<input type="radio" name="ultr_slot_menu" id="ultra_menu_tech_details" '.$ultraslot_tech.' />';
		break;
		case 'ultraslot_case':
			$ultraslot_case = ''; 
			if($config['site']['currentPage'] == 'ultr_slot_casestudy') 
			{
				$ultraslot_case = 'checked'; 
			}
			return '<input type="radio" name="ultr_slot_menu" id="ultra_menu_case_studies" '.$ultraslot_case.'  />';
		break;
		case 'ultraslot_app':
			$ultraslot_app = ''; 
			if($config['site']['currentPage'] == 'ultr_slot_typical_app') 
			{
				$ultraslot_app = 'checked'; 
			}
			return '<input type="radio" name="ultr_slot_menu" id="ultra_menu_slot_app" '.$ultraslot_app.' />';
		break;
		case 'ultraslot_testimonial':
			$ultraslot_testimonial = ''; 
			if($config['site']['currentPage'] == 'ultraslotdrain_testimonal') 
			{
				$ultraslot_testimonial = 'checked'; 
			}
			return '<input type="radio" name="ultr_slot_menu" id="ultra_menu_testimonial" '.$ultraslot_testimonial.' />';
		break;
		case 'ultraslot_feature':
			$ultraslot_feature = ''; 
			if($config['site']['currentPage'] == 'ultraslot_features_benefits') 
			{
				$ultraslot_feature = 'checked'; 
			}
			return '<input type="radio" name="ultr_slot_menu" id="ultra_slot_features_benifits" '.$ultraslot_feature.' />';
		break;
		case 'access_covers_app':
			$access_covers_app = ''; 
			if($config['site']['currentPage'] == 'access_covers_view_by_app') 
			{
				$access_covers_app = 'checked'; 
			}
			return '<input type="radio" name="ultr_slot_menu" id="access_covers_viewbyapp" '.$access_covers_app.' />';
		break;
		case 'access_covers_product':
			$access_covers_product = ''; 
			if($config['site']['currentPage'] == 'access_covers_view_by_product') 
			{
				$access_covers_product = 'checked'; 
			}
			return '<input type="radio" name="ultr_slot_menu" id="access_covers_viewbyprod" '.$access_covers_product.' />';
		break;
		
		
		case 'slotdrain_view_by_app':
			$slotdrain_view_by_app = ''; 
			if($config['site']['currentPage'] == 'slotdrain_view_by_app') 
			{
				$slotdrain_view_by_app = 'checked'; 
			}
			return '<input type="radio" name="ultr_slot_menu" id="slotdrain_viewbyapp" '.$slotdrain_view_by_app.' />';
		break;
		case 'slotdrain_view_by_product':
			$slotdrain_view_by_product = ''; 
			if($config['site']['currentPage'] == 'slotdrain_view_by_product') 
			{
				$slotdrain_view_by_product = 'checked'; 
			}
			return '<input type="radio" name="ultr_slot_menu" id="slotdrain_viewbyprod" '.$slotdrain_view_by_product.' />';
		break;
		
		case 'access_covers_benifits':
			$access_covers_benifits = ''; 
			if($config['site']['currentPage'] == 'access_covers_benifits') 
			{
				$access_covers_benifits = 'checked'; 
			}
			return '<input type="radio" name="ultr_slot_menu" id="access_covers_benifits" '.$access_covers_benifits.' />';
		break;
		case 'access_duct_covers_benifits':
			$access_duct_covers_benifits = ''; 
			if($config['site']['currentPage'] == 'access_duct_covers_benifits') 
			{
				$access_duct_covers_benifits = 'checked'; 
			}
			return '<input type="radio" name="ultr_slot_menu" id="access_duct_covers_benifits" '.$access_duct_covers_benifits.' />';
		break;
		case 'access_covers_load_cat':
			$access_covers_load_cat = ''; 
			if($config['site']['currentPage'] == 'access_covers_load_cat') 
			{
				$access_covers_load_cat = 'checked'; 
			}
			return '<input type="radio" name="ultr_slot_menu" id="access_covers_load_cat" '.$access_covers_load_cat.' />';
		break;
		
		default:
		break;
	}	
	
}

function debug($var)
{
    echo '<pre>';
    print_r($var);
    echo '</pre>';
}
?>